<%--
  Created by IntelliJ IDEA.
  User: 王旭东
  Date: 2024/12/22
  Time: 16:45
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <meta charset="UTF-8">
    <title>宠物领养</title>
    <!-- 引入Bootstrap CSS -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css">
    <!-- 引入Font Awesome 图标库 -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
    <style>
        body {
            background-color: #f8f9fa;
        }
        .pet-card {
            transition: transform 0.2s;
        }
        .pet-card:hover {
            transform: scale(1.05);
            box-shadow: 0 4px 8px rgba(0,0,0,0.2);
        }
        .comment-table th, .comment-table td {
            vertical-align: middle;
        }
        .comment-table th {
            background-color: #343a40;
            color: #fff;
        }
        .add-comment-form {
            background-color: #fff;
            padding: 20px;
            border-radius: 5px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        }
        .add-comment-form textarea {
            resize: none;
        }
        .pet-image {
            height: 200px;
            object-fit: cover;
        }
        .pet-info {
            background-color: #f1f1f1;
        }
        .scrollable-container {
            max-height: 400px; /* 设置最大高度，根据需要调整 */
            overflow-y: auto;
        }
        .scrollable-container table {
            margin-bottom: 0;
        }
    </style>
</head>
<body>
<!-- 导航栏 -->
<jsp:include page="navigation.jsp"></jsp:include>

<div class="container my-5">
    <!-- 宠物展示 -->
    <div class="row mb-4" id="petListContainer">
        <div class="col-12">
            <h2 class="mb-4">宠物展示</h2>
            <div class="scrollable-container">
                <div class="row">
                    <c:forEach items="${pet}" var="pet">
                        <div class="col-md-4">
                            <div class="card pet-card mb-4">
                                <img src="${pageContext.request.contextPath}/static/images/animal/${pet.pic}" class="card-img-top pet-image" alt="宠物图片">
                                <div class="card-body pet-info">
                                    <h5 class="card-title">${pet.petName}</h5>
                                </div>
                            </div>
                        </div>
                    </c:forEach>
                </div>
            </div>
        </div>
    </div>
    <div>
<h2>添加领养信息</h2>
<form action="${pageContext.request.contextPath}/user/AdoptAdd" method="post">
    <input type="hidden" id="userName" name="userName" value="${sessionScope.user.userName}" readonly required><br><br>

    <label for="pet">宠物:</label>
    <select id="pet" name="pet" required>
        <c:forEach var="pet" items="${pet}">
            <option value="${pet.id}">${pet.petName}</option>
        </c:forEach>
    </select><br><br>

    <input type="hidden" type="date" id="adoptTime" name="adoptTime" value="${currentDate}" required><br><br>

    <!-- 隐藏状态字段 -->
    <input type="hidden" id="state" name="state" value="0">

    <input type="submit" value="添加">
</form>
    </div>
</div>
</body>
</html>